home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 037a / mou_rout.zip / MOU.H < prev    next >
Text File  |  1991-01-08  |  5KB  |  148 lines

  1. /*****************************************************************************
  2.  * PROJECT:  Mouse routines with 'real' graphic cursor in text mode.
  3.  *****************************************************************************
  4.  * MODULE:  MOU.H
  5.  *****************************************************************************
  6.  * DESCRIPTION:
  7.  *   Header file for the mouse routines.
  8.  *
  9.  *****************************************************************************
  10.  * MODIFICATION NOTES:
  11.  *    Date     Author Comment
  12.  * 26-Oct-1990   dk   Initial file.
  13.  * 07-Jan-1991   dk   Fixed bugs and set up for release to Usenet.
  14.  *****************************************************************************
  15.  *
  16.  * DISCLAIMER:
  17.  *
  18.  * Programmers may incorporate any or all code into their programs,
  19.  * giving proper credit within the source. Publication of the
  20.  * source routines is permitted so long as proper credit is given
  21.  * to Dave Kirsch.
  22.  *
  23.  * Copyright (C) 1990, 1991 by Dave Kirsch.  You may use this program, or
  24.  * code or tables extracted from it, as desired without restriction.
  25.  * I can not and will not be held responsible for any damage caused from
  26.  * the use of this software.
  27.  *
  28.  *****************************************************************************
  29.  * This source works with Turbo C 2.0 and MSC 6.0 and above.
  30.  *****************************************************************************/
  31.  
  32. /********************************************************/
  33. /* 26-Oct-1990 - dk                                     */
  34. /*                                                      */
  35. /*  Standard types and constants I use in my programs.  */
  36. /*                                                      */
  37. /********************************************************/
  38.  
  39. typedef unsigned char       byte;
  40. typedef unsigned short int  word;
  41. typedef unsigned short int  boolean;
  42. typedef unsigned long  int  dword;
  43.  
  44. #define FALSE 0
  45. #define TRUE (!FALSE)
  46.  
  47. #ifdef __TURBOC__
  48.   #define FAST pascal     /* for fast calling of functions -- Turbo C */
  49. #else
  50.   #define FAST _fastcall  /* for fast calling of functions -- MicroSoft C 6.0 */
  51.   #define asm _asm
  52. #endif
  53. #define LOCAL   near   /* function can not be called outside of this module */
  54. #define PRIVATE static /* function is private */
  55. #define STATIC  static /* private variables */
  56.  
  57. #ifndef poke
  58. #define poke(a,b,c)     (*((int  far*)MK_FP((a),(b))) = (int)(c))
  59. #define pokeb(a,b,c)    (*((char far*)MK_FP((a),(b))) = (char)(c))
  60. #define peek(a,b)       (*((int  far*)MK_FP((a),(b))))
  61. #define peekb(a,b)      (*((char far*)MK_FP((a),(b))))
  62. #endif
  63.  
  64. /***************************************************/
  65. /* Mon 07-Jan-1991 - dk                            */
  66. /*                                                 */
  67. /*  Variables and defines for the mouse routines.  */
  68. /*                                                 */
  69. /***************************************************/
  70.  
  71. /* Size of mouse "click" ahead buffer. */
  72. #define MOUSEBUFFERSIZE 16
  73.  
  74. /* Bit defines for mouse driver function 12 -- define handler. */
  75. #define MOUSEMOVE      1
  76. #define LEFTBPRESS     2
  77. #define LEFTBRELEASE   4
  78. #define RIGHTBPRESS    8
  79. #define RIGHTBRELEASE 16
  80.  
  81. #define LEFTBDOWN  1
  82. #define RIGHTBDOWN 2
  83.  
  84. /* Shift states for byte a 0:417h
  85.    bit 7 =1 INSert active
  86.    bit 6 =1 Caps Lock active
  87.    bit 5 =1 Num Lock active
  88.    bit 4 =1 Scroll Lock active
  89.    bit 3 =1 either Alt pressed
  90.    bit 2 =1 either Ctrl pressed
  91.    bit 1 =1 Left Shift pressed
  92.    bit 0 =1 Right Shift pressed
  93. */
  94.  
  95. #define SHIFT_RIGHTSHIFT 0x01
  96. #define SHIFT_LEFTSHIFT  0x02
  97. #define SHIFT_SHIFT      0x03 /* Either shift key. */
  98. #define SHIFT_CTRL       0x04
  99. #define SHIFT_ALT        0x08
  100. #define SHIFT_SCROLLLOCK 0x10
  101. #define SHIFT_NUMLOCK    0x20
  102. #define SHIFT_CAPSLOCK   0x40
  103. #define SHIFT_INS        0x80
  104.  
  105. /* Mouse information record */
  106. struct minforectype {
  107.   word buttonstat;
  108.   int  cx, cy;
  109.   byte shiftstate;
  110. };
  111.  
  112. #define MOUINFOREC struct minforectype
  113.  
  114. extern word mousehidden;           /* Is the mouse on? Additive flag */
  115. extern boolean mouseinstalled;     /* Is the mouse installed? */
  116.  
  117. extern volatile int mousex, mousey; /* Mouse coordinates in characters. */
  118.  
  119. /* Initialize the mouse routines -- must be called. */
  120. void    FAST MOUinit(void);
  121.  
  122. /* Deinitialize the mouse routines -- must be called on shutdown.
  123.    Failure to call it will most likely result in a system crash if the mouse
  124.    is moved. */
  125. void    FAST MOUdeinit(void);
  126.  
  127. /* Hide the mouse cursor */
  128. void    FAST MOUhide(void);
  129.  
  130. /* Hide the mouse cursor if it moves or is in a specific rectangular region
  131.    of the screen. */
  132. void    FAST MOUconditionalhide(int x1, int y1, int x2, int y2);
  133.  
  134. /* Show the mouse cursor */
  135. void    FAST MOUshow(void);
  136.  
  137. /* return TRUE if there are events waiting in the buffer. */
  138. boolean FAST MOUcheck(void);
  139.  
  140. /* look at the next event in the buffer, but don't pull it out. */
  141. void    FAST MOUpreview(MOUINFOREC *mouinforec);
  142.  
  143. /* get and remove next event from the buffer. */
  144. void    FAST MOUget(MOUINFOREC *mouinforec);
  145.  
  146. /* return the current status of the mouse buttons (see defines above). */
  147. word    FAST MOUbuttonstatus(void);
  148.